/**
 * output package name
 */
package com.kingdee.eas.custom.basedata.client;

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;

import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath;

import org.apache.log4j.Logger;

import com.kingdee.bos.BOSException;
import com.kingdee.bos.ctrl.kdf.table.IRow;
import com.kingdee.bos.ctrl.kdf.table.KDTSelectBlock;
import com.kingdee.bos.ctrl.kdf.table.KDTSelectManager;
import com.kingdee.bos.ctrl.kdf.table.event.KDTDataFillListener;
import com.kingdee.bos.ctrl.kdf.table.event.KDTDataRequestEvent;
import com.kingdee.bos.ctrl.kdf.table.event.KDTMouseEvent;
import com.kingdee.bos.ctrl.kdf.table.util.KDTableUtil;
import com.kingdee.bos.ctrl.swing.tree.DefaultKingdeeTreeNode;
import com.kingdee.bos.dao.IObjectPK;
import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
import com.kingdee.bos.framework.cache.CacheServiceFactory;
import com.kingdee.bos.metadata.data.SortType;
import com.kingdee.bos.metadata.entity.EntityViewInfo;
import com.kingdee.bos.metadata.entity.FilterInfo;
import com.kingdee.bos.metadata.entity.FilterItemInfo;
import com.kingdee.bos.metadata.entity.SelectorItemCollection;
import com.kingdee.bos.metadata.entity.SelectorItemInfo;
import com.kingdee.bos.metadata.entity.SorterItemInfo;
import com.kingdee.bos.metadata.query.util.CompareType;
import com.kingdee.bos.ui.face.CoreUIObject;
import com.kingdee.bos.ui.face.ItemAction;
import com.kingdee.eas.base.commonquery.IQuerySolutionFacade;
import com.kingdee.eas.base.commonquery.QuerySolutionFacadeFactory;
import com.kingdee.eas.base.commonquery.client.CommonQueryDialog;
import com.kingdee.eas.basedata.assistant.AssistantException;
import com.kingdee.eas.basedata.assistant.Project;
import com.kingdee.eas.basedata.assistant.ProjectCollection;
import com.kingdee.eas.basedata.assistant.ProjectFactory;
import com.kingdee.eas.basedata.assistant.ProjectInfo;
import com.kingdee.eas.basedata.assistant.client.AssitantUtil;
import com.kingdee.eas.basedata.org.CompanyOrgUnitInfo;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.eas.common.client.SysContext;
import com.kingdee.eas.framework.ICoreBase;
import com.kingdee.eas.framework.ITreeBase;
import com.kingdee.eas.framework.TreeBaseInfo;
import com.kingdee.eas.framework.client.MoveTreeEvent;
import com.kingdee.eas.framework.client.tree.KDTreeNode;
import com.kingdee.eas.framework.client.tree.TreeBuilderFactory;
import com.kingdee.eas.framework.client.uisidebar.UISideBarFactory;
import com.kingdee.eas.framework.query.QuickFilteringSupportItems;
import com.kingdee.eas.framework.util.FilterUtility;
import com.kingdee.eas.tools.datatask.DatataskParameter;
import com.kingdee.eas.tools.datatask.client.DatataskCaller;
import com.kingdee.eas.util.SysUtil;
import com.kingdee.eas.util.client.EASResource;

/**
 * output class name
 */
public class F7ProjectMultiListUI extends AbstractF7ProjectMultiListUI
{
    private static final Logger logger = CoreUIObject.getLogger(F7ProjectMultiListUI.class);
    
    public String resClassName = "com.kingdee.eas.basedata.assistant.client.AssistantResource4";
    boolean flag = false;
    private final Color freezeColor = new Color(232, 232, 227);
    public boolean isCanceled = true;
    public ProjectInfo data = null;
    public ProjectCollection datas = null;
    
    
    @Override
    public void onShow() throws Exception {
    	super.onShow();
    	tblMainMu.getSelectManager().setSelectMode(KDTSelectManager.MULTIPLE_ROW_SELECT);
 
    	
    	Object[] obj = (Object[])this.getUIContext().get("da");
    	
    	if(obj == null || ( obj.length ==1 && null == obj[0])){
    	}else{
	    	for(Object sa :obj){
	    		ProjectInfo da = (ProjectInfo)sa;
	    		 rowz = tblMainMu.addRow();
			     rowz.getCell("id").setValue(da.getId());
			     rowz.getCell("number").setValue(da.getNumber());
			     rowz.getCell("name").setValue(da.getName());
			     rowz.getCell("company").setValue(da.getCompany());
			     rowz.getCell("type").setValue(da.getType());
			     rowz.getCell("description").setValue(da.getDescription());
	    	}
    	}
    }
    
    public void actionConfirm_actionPerformed(ActionEvent e) throws Exception {
	      this.isCanceled = false;
	      getData();
	      if ((this.datas == null)) {
	       return;
	      } 
	      getUIWindow().close();
    }
    
    public void actionExit_actionPerformed(ActionEvent e) throws Exception {

	  this.isCanceled = true;
	  getUIWindow().close();
	}
    

	private void getData() throws Exception { 
			 Set selectedIds =  new HashSet();
	         for (int j = 0; j < tblMainMu.getRowCount(); j++)
	         {
	           selectedIds.add(this.tblMainMu.getRow(j).getCell("id").getValue().toString());
	         }
	       
	        EntityViewInfo view = new EntityViewInfo();
	        FilterInfo filter = new FilterInfo();       
	        filter.getFilterItems().add(new FilterItemInfo("id", selectedIds,CompareType.INCLUDE));
			view.setFilter(filter);   			    					
	       this.datas = ProjectFactory.getRemoteInstance().getProjectCollection(view);
	      
		 if ((this.datas == null) || (this.datas.size() <= 0))
	       {
	         this.datas = null;
	       }
	}
 
    IRow rowz = null;
    @Override
    public void actionRu_actionPerformed(ActionEvent e) throws Exception {
    	
    	SelectorItemCollection sic = new SelectorItemCollection();
	     sic.add(new SelectorItemInfo("id"));
	     sic.add(new SelectorItemInfo("number"));
	     sic.add(new SelectorItemInfo("name"));
    	
    	KDTSelectBlock sb = null;
    	int size = this.tblMain.getSelectManager().size();
    	int bottom = 0;
    	
      for (int i = 0; i < size; ++i){
        sb = this.tblMain.getSelectManager().get(i);
        if(sb != null){
	        bottom = sb.getBottom();
	       for (int z = sb.getTop(); z <= bottom; ++z){
	    	
	    	IObjectPK selectedPkk = new ObjectUuidPK(this.tblMain.getRow(z).getCell("id").getValue().toString());
		    ProjectInfo da = ProjectFactory.getRemoteInstance().getProjectInfo(selectedPkk, sic);
	
			 rowz = tblMainMu.addRow();
		     rowz.getCell("id").setValue(da.getId());
		     rowz.getCell("number").setValue(da.getNumber());
		     rowz.getCell("name").setValue(da.getName());
		     rowz.getCell("company").setValue(da.getCompany());
		     rowz.getCell("type").setValue(da.getType());
		     rowz.getCell("description").setValue(da.getDescription());
		     
		     if(tblMainMu.getRowCount() != 0){
			     for(int j = 0; j < tblMainMu.getRowCount()-1; j++){
			    	 if(tblMainMu.getCell(tblMainMu.getRowCount()-1,"id").getValue().equals(tblMainMu.getCell(j,"id").getValue()) ){
			    		 tblMainMu.removeRow(tblMainMu.getRowCount()-1);
			    		 break;
			    	 }
			     }
		     }
	    	}
       }
    }
    }
    
    @Override
    public void actionChu_actionPerformed(ActionEvent e) throws Exception {
    	
    	KDTSelectBlock sb = null;
    	
    	int size = this.tblMainMu.getSelectManager().size();
    	int bottom = 0;
    	int top =0;
      for (int i = 0; i < size; ++i){
        sb = this.tblMainMu.getSelectManager().get(i);
        if(sb != null){
	        bottom = sb.getBottom();
	         top =sb.getTop();
	       for (int z =top; z <= bottom; bottom-- ){	    	   
		    		tblMainMu.removeRow(z);
		    	 
	       }   
	       }else if(tblMainMu.getRowCount() != 0){
	    		tblMainMu.removeRow(tblMainMu.getRowCount()-1);
			}
        }
    }
   
    
	    	
    public void tblMain_tableClicked(KDTMouseEvent e) throws Exception {
		if (e.getType() != 0) {
	       if (e.getClickCount() != 2)	      
	       actionRu_actionPerformed(null);
		}   		
	}

    @Override
    public void actionView_actionPerformed(ActionEvent e) throws Exception {

    }
    public void onLoad() throws Exception {
        this.btnOk.setEnabled(true);
        this.btnExit.setEnabled(true);
        this.btnchu.setEnabled(true);
        this.btnru.setEnabled(true);
        this.tblMainMu.getStyleAttributes().setLocked(true);
        
        this.actionQuery.setVisible(false);
        super.onLoad();
        
       
        
/* 795 */     IQuerySolutionFacade iQuery = QuerySolutionFacadeFactory.getRemoteInstance();
/*     */ 
/* 797 */     String queryName = getQueryInfo(this.mainQueryPK).getFullName();
/*     */ 
/* 799 */     EntityViewInfo ev = (EntityViewInfo)iQuery.getDefaultFilterInfo(super.getClass().getName(), queryName);
/*     */
/*     */ 
/* 802 */     EntityViewInfo tempQuery = null;
/* 803 */     if (ev == null) {
/* 804 */       ev = new EntityViewInfo();
/*     */     }
/*     */ 
/* 807 */     if (ev != null) {
/* 808 */       tempQuery = getEntityViewInfo(ev);
/*     */     }
/*     */ 
/* 811 */     buildTreeFilter();
/* 812 */     if ((tempQuery != null) && (FilterUtility.hasFilterItem(this.mainQuery.getFilter())))
/*     */     {
/* 814 */       this.mainQuery = tempQuery;
/*     */     }
/*     */ 
/* 817 */     if (getCurrentOrder() != null)
/* 818 */       this.mainQuery.getSorter().add(getCurrentOrder());
/*     */     else {
/* 820 */       this.mainQuery.getSorter().add(new SorterItemInfo(getLongNumberFieldName()));
/*     */
/*     */     }
/*     */ 
/* 824 */     execQuery();
/* 832 */     setIncludeAllChildren(true);
/* 835 */     this.tblMain.getViewManager().setFreezeView(0, 3);
/*     */   }
    
    
    QuickFilteringSupportItems qfsi = new QuickFilteringSupportItems(true, true);
    
	    protected QuickFilteringSupportItems getQuickFilteringSupport()  {			
	         return this.qfsi.supportExecutionWithoutFilters();			    	
	     }  
			    
       public F7ProjectMultiListUI() throws Exception {
           setUITitle(EASResource.getString(this.resClassName, "ProjectList"));
        }
    
       protected String getRootName() {
           return EASResource.getString(this.resClassName, "ProjectList");
       }
   
    /*     */   public void setMoveTreeDisable() {
    /* 111 */     this.btnMoveTree.setVisible(false);
    /* 112 */     this.menuItemMoveTree.setVisible(false);
    /*     */   }
    /*     */
    /*     */
    /*     */   public void actionMoveTree_actionPerformed(ActionEvent e)
    /*     */     throws Exception
    /*     */   {
    /* 119 */     super.actionMoveTree_actionPerformed(e);
    /*     */
    /*     */ 
    /* 122 */     Project project = new Project();
    /* 123 */     CacheServiceFactory.getInstance().discardType(project.getType());
    /*     */
    /*     */ 
    /* 126 */     ActionEvent event = new ActionEvent(this.btnAddNew, 0, "AddNew");
    /*     */
    /*     */ 
    /* 129 */     execQuery();
    /* 130 */     actionRefresh_actionPerformed(event);
    /*     */   }
    /*     */
    /*     */

    /*     */
    /*     */   public void loadFields()
    /*     */   {
    /* 172 */     super.loadFields();
    /*     */   }
    /*     */
    /*     */
    /*     */
    /*     */   public void storeFields()
    /*     */   {
    /* 179 */     super.storeFields();
    /*     */   }
    /*     */
    /*     */   protected String getQueryFieldName() {
    /* 183 */     return Project.class.toString();
    /*     */   }
    /*     */
    
    
    /*     */   protected ITreeBase getTreeInterface() throws Exception {
    /* 187 */     return ProjectFactory.getRemoteInstance();
    /*     */   }
    /*     */
//    /*     */   public void actionEdit_actionPerformed(ActionEvent e) throws Exception {
//    /* 191 */     checkSelected();
//    /* 192 */     int[] selectRows = KDTableUtil.getSelectedRows(this.tblMain);
//    /* 193 */     if (selectRows.length > 0) {
//    /* 194 */       Boolean isSysCreate = (Boolean)this.tblMain.getRow(selectRows[0]).getCell("isSysCreate").getValue();
//    /*     */ 
//    /* 196 */       if ((isSysCreate != null) && (isSysCreate.booleanValue())) {
//    /* 197 */         throw new AssistantException(AssistantException.UPDATE_SYS_CREATE);
//    /*     */       }
//    /*     */ 
//    /*     */     }
//    /*     */ 
//    /* 202 */     super.actionEdit_actionPerformed(e);
//    /*     */   }
    /*     */
    /*     */   public void actionRemove_actionPerformed(ActionEvent e) throws Exception {
    /* 206 */     checkSelected();
    /* 207 */     int[] selectRows = KDTableUtil.getSelectedRows(this.tblMain);
    /* 208 */     for (int i = 0; i < selectRows.length; ++i) {
    /* 209 */       Boolean isSysCreate = (Boolean)this.tblMain.getRow(selectRows[i]).getCell("isSysCreate").getValue();
    /*     */ 
    /* 211 */       if ((isSysCreate != null) && (isSysCreate.booleanValue())) {
    /* 212 */         throw new AssistantException(AssistantException.DEL_SYS_CREATE);
    /*     */       }
    /*     */     }
    /* 215 */     super.actionRemove_actionPerformed(e);
    /*     */   }
    /*     */
    /*     */   protected void initListener() {
    /* 219 */     super.initListener();
    /* 220 */     this.tblMain.addKDTDataFillListener(new KDTDataFillListener() {
    /*     */       public void afterDataFill(KDTDataRequestEvent e) {
    /* 222 */         int start = e.getFirstRow();
    /* 223 */         int end = e.getLastRow();
    /* 224 */         if (!(F7ProjectMultiListUI.this.flag))
    /* 225 */           F7ProjectMultiListUI.this.setTreeDisplayStyle(start, end + 1);
    /*     */       }
    /*     */     });
    /*     */   }
    /*     */
    /*     */   private void setTreeDisplayStyle(int start, int end)
    /*     */   {
    /* 238 */     int i = start; for (int count = end; i < count; ++i) {
    /* 239 */       IRow row = this.tblMain.getRow(i);
    /* 240 */       if (row == null) {
    /*     */         continue;
    /*     */       }
    /* 243 */       if (row.getCell("isCFreeze") != null) {
    /* 244 */         boolean isCFreeze = ((Boolean)row.getCell("isCFreeze").getValue()).booleanValue();
    /*     */ 
    /* 246 */         if (isCFreeze) {
    /* 247 */           row.getStyleAttributes().setBackground(this.freezeColor);
    /*     */         }
    /*     */       }
    /* 250 */       String id = (String)row.getCell("id").getValue();
    /* 251 */       int level = 1;
    /* 252 */       if ((row.getCell("level").getValue() != null) && (row.getCell("level").getValue() instanceof Integer))
    /*     */       {
    /* 254 */         level = ((Integer)row.getCell("level").getValue()).intValue();
    /*     */       }
    /* 256 */       Object numberValue = row.getCell("number").getValue();
    /* 257 */       if (!(numberValue instanceof String)) {
    /* 258 */         return;
    /*     */       }
    /* 260 */       String acctNumber = (String)numberValue;
    /* 261 */       boolean isAcctLeaf = false;
    /* 262 */       if ((row.getCell("isLeaf").getValue() != null) && (row.getCell("isLeaf").getValue() instanceof Boolean))
    /*     */       {
    /* 264 */         isAcctLeaf = ((Boolean)row.getCell("isLeaf").getValue()).booleanValue();
    /*     */
    /*     */       }
    /*     */ 
    /* 268 */        NumberExpandInfo acctNumberExpandInfo = new NumberExpandInfo();
    /* 269 */       acctNumberExpandInfo.setAcctId(id);
    /* 270 */       acctNumberExpandInfo.setLevel(level);
    /* 271 */       acctNumberExpandInfo.setLeaf(isAcctLeaf);
    /* 272 */       acctNumberExpandInfo.setNumber(acctNumber);
    /* 273 */       acctNumberExpandInfo.setExpandStatus(true);
    /* 274 */       row.getCell("number").setValue(acctNumberExpandInfo);
    /*     */     }
    /*     */   }
   
    
    /*     */   protected FilterInfo getDefaultFilterForQuery()
    /*     */   {
    /* 468 */     FilterInfo filterInfo = super.getDefaultFilterForQuery();
    /*     */ 
    /* 470 */     FilterInfo filterInfo1 = new FilterInfo();
    /*     */ 
    /* 472 */     if (AssitantUtil.getProjectIsolateParam().equals("true"))

    /*     */     {
    /* 485 */       CompanyOrgUnitInfo currentCompany = SysContext.getSysContext().getCurrentFIUnit();
    /*     */
    /*     */ 
    /* 488 */       if (currentCompany.isIsAssistantOrg())
    /*     */       {
    /* 490 */         filterInfo1.getFilterItems().add(new FilterItemInfo("company.id", currentCompany.getId()));
    /*     */ 
    /* 492 */         filterInfo1.getFilterItems().add(new FilterItemInfo("company.id", currentCompany.getMainOrg().getId()));
    /*     */ 
    /* 494 */         filterInfo1.setMaskString("(#0 or #1)");
    /*     */       } else {
    /* 496 */         filterInfo1.getFilterItems().add(new FilterItemInfo("company.id", currentCompany.getId()));
    /*     */       }
    /*     */ 
    /*     */     }
    /*     */ 
    /*     */     try
    /*     */     {
    /* 503 */       if (filterInfo == null) {
    /* 504 */         return filterInfo1;
    /*     */       }
    /* 506 */       filterInfo.mergeFilter(filterInfo1, "AND");
    /*     */     } catch (BOSException e) {
    /* 508 */       e.printStackTrace();
    /*     */     }
    /*     */ 
    /* 511 */     return filterInfo;
    /*     */   }
    /*     */
    /*     */

    /*     */
    /*     */
    /*     */   protected ICoreBase getBizInterface()
    /*     */     throws Exception
    /*     */   {
    /* 529 */     return ProjectFactory.getRemoteInstance();
    /*     */   }
    /*     */
    /*     */
    /*     */
    /*     */
    /*     */
    /*     */   protected String getLongNumberFieldName()
    /*     */   {
    /* 538 */     return "longNumber";
    /*     */   }
    /*     */
    /*     */   protected FilterInfo getDefaultFilterForTree() {
    /* 542 */     FilterInfo filterInfo = new FilterInfo();
    /* 543 */     if (AssitantUtil.getProjectIsolateParam().equals("true"))
    /*     */
    /*     */     {
    /* 552 */       filterInfo.getFilterItems().add(new FilterItemInfo("company.id", SysContext.getSysContext().getCurrentFIUnit().getId()));
    /*     */
    /*     */     }
    /*     */ 
    /* 556 */     return filterInfo;
    /*     */   }
    /*     */
    /*     */
    /*     */
    /*     */
    /*     */
    /*     */   protected String getKeyFieldName()
    /*     */   {
    /* 565 */     return "id";
    /*     */   }

    /*     */   protected void SelectNode()
    /*     */     throws EASBizException, BOSException, Exception
    /*     */   {

    /*     */ 
    /* 590 */     DefaultKingdeeTreeNode selectNode = (DefaultKingdeeTreeNode)((DefaultTreeModel)this.treeMain.getModel()).getRoot();
    /* 591 */     if (selectNode == null) {

    /* 593 */       return;
    /*     */     }
    /*     */ 
    /* 596 */     Object[] nodeArray = new Object[selectNode.getChildCount()];
    /* 597 */     for (int j = 0; j < selectNode.getChildCount(); ++j)
    /*     */     {
    /* 599 */       nodeArray[j] = selectNode.getChildAt(j);
    /*     */     }
    /*     */ 
    /* 602 */     TreeBaseInfo selectRow = null;
    /*     */     try {
    /* 604 */       if (getSelectedKeyValue() != null)
    /* 605 */         selectRow = getTreeInterface().getTreeBaseInfo(new ObjectUuidPK(getSelectedKeyValue()));
    /*     */     }
    /*     */     catch (EASBizException e)
    /*     */     {
    /* 609 */       e.printStackTrace();
    /*     */     } catch (BOSException e) {
    /* 611 */       e.printStackTrace();
    /*     */     } catch (Exception e) {
    /* 613 */       e.printStackTrace();
    /*     */     }
    /* 615 */     String fullLN = "";
    /* 616 */     if (selectRow == null)
    /*     */     {
    /* 619 */       return;
    /*     */     }
    /* 621 */     fullLN = selectRow.getLongNumber();
    /* 622 */     DefaultKingdeeTreeNode selectNode2 = null;
    /* 623 */     for (int j = 0; j < nodeArray.length; ++j)
    /*     */     {
    /* 625 */       if (nodeArray[j] == null) continue; if (!(nodeArray[j] instanceof DefaultKingdeeTreeNode)) {
    /*     */         continue;
    /*     */       }
    /*     */ 
    /* 629 */       DefaultKingdeeTreeNode tempNode = (DefaultKingdeeTreeNode)nodeArray[j];
    /* 630 */       if (tempNode.getUserObject() == null) {
    /*     */         continue;
    /*     */       }
    /*     */ 
    /* 634 */       TreeBaseInfo tempTree = (TreeBaseInfo)tempNode.getUserObject();
    /*     */ 
    /* 636 */       if (fullLN.indexOf(tempTree.getLongNumber() + "!") != 0)
    /*     */         continue;
    /* 638 */       selectNode2 = tempNode;
    /* 639 */       break;
    /*     */
    /*     */
    /*     */     }
    /*     */ 
    /* 644 */     if ((selectNode2 != null) && (selectNode2.getChildCount() > 0) && (selectNode2.getChildAt(0) != null) && (selectNode2.getChildAt(0).toString() == null))
    /*     */     {
    /* 646 */       if ((selectNode2 != null) && (selectNode2.getPath() != null)) {
    /* 647 */         TreePath path = new TreePath(selectNode2.getPath());
    /* 648 */         this.treeMain.setSelectionPath(path);
    /*     */       }
    /*     */     }
    /* 659 */     super.SelectNode();
    /*     */   }
    /*     */
    /*     */
    /*     */
    /*     */
    /*     */
    /*     */
    /*     */
    /*     */
    /*     */   protected void refresh(ActionEvent e)
    /*     */     throws Exception
    /*     */   {
    /*     */ 
    /* 677 */     if (e == null) {
    /* 678 */       return;
    /*     */     }
    /* 680 */     ItemAction action = getActionFromActionEvent(e);
    /* 681 */     if (action == null) {
    /* 682 */       return;
    /*     */     }
//    /* 684 */     if (action.equals(this.actionAddNew)) {
//    /* 685 */       TreePath oldPath = this.treeMain.getSelectionPath();
//    /* 686 */       initTree();
//    /* 687 */       this.treeMain.setSelectionPath(TreePathUtil.getNewTreePath(this.treeMain, this.treeMain.getModel(), oldPath));
//    /*     */     }
    /*     */ 
//    /* 690 */     if (action.equals(this.actionView))
//    /*     */     {
//    /* 692 */       e = new ActionEvent(this.btnEdit, 0, "Edit");
//    /*     */
//    /*     */     }
    /*     */ 
//    /* 696 */     boolean flag = false;
//    /* 697 */     if ((action.equals(this.actionRemove)) || (action.equals(this.actionEdit)))
//    /*     */     {
//    /* 699 */       KDTreeNode treeNode = (KDTreeNode)this.treeMain.getLastSelectedPathComponent();
//    /*     */ 
//    /* 701 */       if ((treeNode != null) && (treeNode.getParent() != null)) {
//    /* 703 */         flag = true;
//    /*     */       }
//    /*     */     }
    /* 706 */     super.refresh(e);
    /*     */ 

    /*     */   }
    /*     */
    /*     */   protected void moveTreeNode(MoveTreeEvent e)
    /*     */   {
    /* 714 */     if ((!(isMoveTree())) || (((TreeBaseInfo)getSelectedTreeNode().getUserObject()).getId().toString() == null))
    /*     */
    /*     */     {
    /* 717 */       return;
    /*     */     }
    /*     */ 
    /* 720 */     super.moveTreeNode(e);
    /*     */   }
    /*     */
    /*     */
    /*     */
    /*     */
    /*     */
    /*     */
    /*     */
    /*     */   protected SelectorItemCollection getSelectorForTree()
    /*     */   {
    /* 731 */     SelectorItemCollection sc = new SelectorItemCollection();
    /* 732 */     sc.add("name");
    /* 733 */     sc.add("level");
    /* 734 */     sc.add("longnumber");
    /* 735 */     sc.add("isLeaf");
    /* 736 */     return sc;
    /*     */   }
    /*     */
    /*     */
    /*     */
    /*     */
    /*     */
    /*     */
    /*     */
    /*     */
    /*     */   protected void initTree()
    /*     */     throws Exception
    /*     */   {
    /* 749 */     TreeSelectionListener[] listeners = this.treeMain.getTreeSelectionListeners();
    /*     */ 

    /*     */ 
    /* 754 */     this.treeBuilder = TreeBuilderFactory.createTreeBuilder(getLNTreeNodeCtrl(), 1, getTreeExpandLevel(), getDefaultFilterForTree(), getSelectorForTree());
    /*     */
    /*     */
    /*     */ 
    /* 758 */     if (getRootName() != null) {
    /* 759 */       KDTreeNode rootNode = new KDTreeNode(getRootObject());
    /* 760 */       ((DefaultTreeModel)this.treeMain.getModel()).setRoot(rootNode);
    /*     */     } else {
    /* 762 */       ((DefaultTreeModel)this.treeMain.getModel()).setRoot(null);
    /*     */     }
    /* 764 */     this.treeBuilder.buildTree(this.treeMain);

    /* 766 */     this.treeMain.setShowPopMenuDefaultItem(true);
    /* 767 */     initPopmenu();
    /* 768 */     SelectNode();
    /*     */   }
    /*     */
    /*     */
   
    		
    /* 840 */   CommonQueryDialog dialog = null;
    /*     */   public void actionQuery_actionPerformed(ActionEvent e)/*     */     throws Exception
    /*     */   {
    /* 843 */     IQuerySolutionFacade iQuery = QuerySolutionFacadeFactory.getRemoteInstance();
    /*     */ 
    /* 845 */     String queryName = getQueryInfo(this.mainQueryPK).getFullName();
    /*     */ 
    /* 847 */     if ((isPerformDefaultQuery(iQuery, queryName)) || 
    /*     */
    /*     */
    /* 850 */       (isFirstDefaultQuery()) || 
    /*     */
    /* 852 */       (isPerformDefaultQuery(iQuery, queryName)) || 
    /*     */
    /*     */
    /*     */
    /* 856 */       (isFirstDefaultQuery())) {
    /*     */       return;
    /*     */     }
    /* 859 */     if (this.dialog == null)
    /*     */     {
    /* 861 */       this.dialog = initCommonQueryDialog();
    /* 862 */       this.dialog.setMaxReturnCountVisible(true);
    /*     */     }
    /* 864 */     if (isSupportDynQuery())
    /*     */     {
    /* 866 */       this.dialog.setDynQueryVisible(true);
    /*     */     }
    /* 868 */     if (this.dialog.show())
    /*     */     {
    /* 870 */       this.tHelper.setDialog(this.dialog);
    /* 871 */       this.MaxReturnRowCount = iQuery.getMaxNumView(super.getClass().getName(), queryName);
    /* 872 */       this.mainQuery.getSorter().clear();
    /* 873 */       this.mainQuery = getEntityViewInfo((EntityViewInfo)this.dialog.getEntityViewInfoResult().clone());
    /* 874 */       setDefaultEntityViewInfo(this.dialog.getEntityViewInfoResult());
    /* 875 */       if ((this.mainQuery.getSorter() != null) && (this.mainQuery.getSorter().size() > 0))
    /*     */
    /*     */       {
    /* 878 */         setIsIgnoreOrder(true);
    /*     */       }
    /*     */       else {
    /* 881 */         setIsIgnoreOrder(false);
    /*     */
    /*     */       }
    /*     */ 
    /* 885 */       prepareQuery(null).callHandler();
    /*     */
    /*     */ 
    /* 888 */       if ((this.mainQuery.getSorter() != null) && (this.mainQuery.getSorter().size() == 0))
    /*     */       {
    /* 890 */         SorterItemInfo sinfo = new SorterItemInfo();
    /* 891 */         sinfo.setSortType(SortType.ASCEND);
    /* 892 */         sinfo.setPropertyName("longNumber");
    /* 893 */         this.mainQuery.getSorter().add(sinfo);
    /*     */
    /*     */       }
    /*     */ 
    /* 897 */       handleDynQuery(this.mainQuery, this.dialog);
    /*     */ 
    /* 899 */       doQuery(this.dialog);
    /* 900 */       setLocatePre(true);
    /* 901 */       execQuery();
    /* 902 */       setIsIgnoreOrder(false);
    /* 903 */       UISideBarFactory.reBuildSideBar(this);
    /*     */     }
    /*     */     else
    /*     */     {
    /* 907 */       this.tHelper.setDialog(this.dialog);
    /* 908 */       SysUtil.abort();
    /*     */     }
    /*     */   }
    /*     */
    /*     */
    /*     */
    /*     */
    /*     */
    /*     */
    /*     */
    /*     */
    /*     */   public SelectorItemCollection getSelectors()
    /*     */   {
    /* 921 */     SelectorItemCollection sic = new SelectorItemCollection();
    /* 922 */     sic.add(new SelectorItemInfo("id"));
    /* 923 */     sic.add(new SelectorItemInfo("name"));
    /* 924 */     sic.add(new SelectorItemInfo("number"));
    /* 925 */     sic.add(new SelectorItemInfo("level"));
    /* 926 */     sic.add(new SelectorItemInfo("isLeaf"));
    /* 927 */     sic.add(new SelectorItemInfo("description"));
    /* 928 */     sic.add(new SelectorItemInfo("type"));
    /* 929 */     sic.add(new SelectorItemInfo("status"));
    /* 930 */     sic.add(new SelectorItemInfo("dutyPerson"));
    /* 931 */     sic.add(new SelectorItemInfo("scheduleStartDate"));
    /* 932 */     sic.add(new SelectorItemInfo("schedulEndDate"));
    /* 933 */     sic.add(new SelectorItemInfo("factStartDate"));
    /* 934 */     sic.add(new SelectorItemInfo("factEndDate"));
    /* 935 */     sic.add(new SelectorItemInfo("process"));
    /* 936 */     sic.add(new SelectorItemInfo("address"));
    /* 937 */     sic.add(new SelectorItemInfo("attachment"));
    /* 938 */     sic.add(new SelectorItemInfo("id"));
    /* 939 */     sic.add(new SelectorItemInfo("parent"));
    /* 940 */     sic.add(new SelectorItemInfo("parent.level"));
    /* 941 */     sic.add(new SelectorItemInfo("parent.name"));
    /* 942 */     sic.add(new SelectorItemInfo("parent.number"));
    /* 943 */     sic.add(new SelectorItemInfo("parent.isLeaf"));
    /* 944 */     sic.add(new SelectorItemInfo("parent.status"));
    /* 945 */     sic.add(new SelectorItemInfo("company"));
    /* 946 */     sic.add(new SelectorItemInfo("prjManager.*"));
    /* 947 */     sic.add(new SelectorItemInfo("company.*"));
    /* 948 */     sic.add(new SelectorItemInfo("isListItem"));
    /*     */ 
    /* 950 */     return sic;
    /*     */   }
    /*     */
    /*     */   protected ArrayList getImportParam() {
    /* 954 */     DatataskParameter param = new DatataskParameter();
    /* 955 */     param.solutionName = "eas.basedata.common.project";
    /* 956 */     param.alias = EASResource.getString(this.resClassName, "ProjectList");
    /* 957 */     param.datataskMode = 0;
    /* 958 */     ArrayList paramList = new ArrayList();
    /* 959 */     paramList.add(param);
    /* 960 */     return paramList;
    /*     */   }
    /*     */
    /*     */   protected ArrayList getExportParam() {
    /* 964 */     DatataskParameter param = new DatataskParameter();
    /* 965 */     param.solutionName = "eas.basedata.common.project";
    /* 966 */     param.alias = EASResource.getString(this.resClassName, "ProjectList");
    /*     */ 
    /* 968 */     param.datataskMode = 1;
    /* 969 */     ArrayList paramList = new ArrayList();
    /* 970 */     paramList.add(param);
    /* 971 */     return paramList;
    /*     */   }
    /*     */
    /*     */   public void actionImportData_actionPerformed(ActionEvent e) throws Exception
    /*     */   {
    /* 976 */     importData();
    /*     */ 
    /* 978 */     ActionEvent event = new ActionEvent(this.btnAddNew, 0, "AddNew");
    /* 979 */     actionRefresh_actionPerformed(event);
    /*     */   }
    /*     */
    /*     */   private void importData() throws Exception {
    /* 983 */     DatataskCaller task = new DatataskCaller();
    /* 984 */     task.setParentComponent(this);
    /* 985 */     task.invoke(getImportParam(), 0, true);
    /*     */   }

}